* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

.site-title {
  view-transition-name: site-title;
  transition: 0.2s ease;
}

.item {
  transition: 0.2s ease;
}

#aside-container {
  position: sticky;
  top: 0;
}

#aside-container .nav {
  position: static;
  top: unset;
}

.search-icon {
  position: absolute;
  top: 20px;
  right: 0px;
  width: 24px;
  height: 24px;
  padding: 4px;
  appearance: none;
  outline: none;

  &:after {
    content: '🔍';
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--background-color);
    text-align: center;
    vertical-align: middle;
    line-height: 24px;
  }
}

.search-icon:checked + .search-form {
  display: block !important;
}

.search-form {
  display: none;
  background: var(--code-background-color);
  color: var(--secondary-color);
  padding: 8px;
  border-radius: var(--box-border-radius);

  > input {
    border: 1px solid var(--background-color);
    border-radius: var(--box-border-radius);
    background: var(--code-background-color);
    color: var(--secondary-color);
    outline: none;
    font-size: 12px;
    line-height: 2.4;
    padding: 0 0.5em;
    box-sizing: border-box;
    width: 100%;
  }
}

.copyright-wrap {
  color: #666;
  line-height: 1.5;
  font-size: 14px;
  display: none;
  padding: 8px;
}

@media screen and (min-width: 600px) {
  #aside-container {
    height: 100vh;
    height: 100svh;
    overflow-y: auto;
  }

  .search-form {
    display: block;
  }

  .search-icon {
    display: none;
  }

  .copyright-wrap {
    display: block;
  }
}

#back-to-top {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--code-background-color);
  color: var(--secondary-color);
  width: 32px;
  height: 32px;
  border-radius: 100%;
  border: none;
  font-size: 24px;
  text-decoration: none;
  opacity: 0;
  transition:
    opacity 0.3s,
    transform 0.3s;
  z-index: 1000;

  &:hover {
    transform: translateY(-3px);
  }

  &:active {
    transform: translateY(1px);
  }

  img {
    filter: var(--icon-secondary-filter);
  }
}

/* Use @scroll-timeline to control the display of the button */
@supports (animation-timeline: view()) {
  #back-to-top {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s linear both;
    animation-timeline: view(block 0 100vh);
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      pointer-events: none;
    }
    to {
      opacity: 0.9;
      pointer-events: auto;
    }
  }
}
